package com.dxh.blog.service.impl;

import com.dxh.blog.dao.ArticleMapper;
import com.dxh.blog.entity.Article;
import com.dxh.blog.service.ArticleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Dengxh
 * @Date: 2020/12/20 16:01
 * @Description:
 */
@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public PageInfo<Article> listArticle(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Article> articles = articleMapper.selectAllArticle();
        PageInfo<Article> articlePage = new PageInfo<>(articles);

        return articlePage;
    }
}
